package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.domain.vo.AreasVO;
import com.dongdongshop.service.AreasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("areas")
public class AreasController {

    @Autowired
    private AreasService areasService;

    //根据城市id查询对应的区域
    @PostMapping
    public Result getAreasByCityId(@RequestParam String cityId){
        List<AreasVO> areasVOList = areasService.getAreasByCityId(cityId);
        return Result.OK().setData(areasVOList);
    }

}
